<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="button" value="get请求" class="get">
    <input type="button" value="post请求" class="post">
    <script src="./lib/axios.js"></script>
    <script>
        document.querySelector(".get").onclick = function () {
            axios.get("https://autumnfish.cn/api/joke/list?num=3").then(function (res) {
                console.log(res.data.data);
            }, function (err) {
                console.log(err);
            })
        }

        document.querySelector(".post").onclick = function () {
            axios({
                method: "POST",
                url: "https://autumnfish.cn/api/user/reg",
                data: {
                    username: "root"
                }
            }).then(function (res) {
                console.log(res);
            }, function (err) {
                console.log(err);
            })
        }
    </script>


</body>

</html>